<template>
  <div>
    <el-dialog title="" :visible.sync="dialogVisible" width="30%">
      <div>
        <el-form ref="form" :model="formdata" label-width="80px">
          <el-col :span="24">
            <el-form-item label="用户名称">
              <el-input
                size="small"
                v-model="formdata.userName"
                placeholder=""
                disabled
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="手机号码">
              <el-input
                size="small"
                v-model="formdata.phone"
                placeholder=""
                disabled
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="新密码">
              <el-input
                size="small"
                v-model="formdata.password"
                placeholder="请输入新密码"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </div>
      <div slot="footer">
        <el-button size="small" @click="quxiao">取 消</el-button>
        <el-button size="small" type="primary" @click="sure">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { updatePasswordapi } from '@/api/prwpaid/configura/UserCode'
export default {
  name: 'CallPolicePutPassword',

  data() {
    return {
      formdata: {},
      dialogVisible: false
    }
  },

  mounted() {},

  methods: {
    async sure() {
      const { password, phone, ...obj } = this.formdata
      const res = await updatePasswordapi({ password, phone })
      this.$message({
        type: res.code == '200' ? 'success' : 'warning',
        message: res.code == '200' ? '重置成功' : res.message
      })
      if (res.code == '200') this.$emit('getlist')
      if (res.code == '200') this.quxiao()
    },
    toput(val) {
      this.dialogVisible = true
      this.formdata = { ...val }
    },
    quxiao() {
      this.formdata = {}
      this.dialogVisible = false
    }
  }
}
</script>
